{include file="common/header"}
{include file="common/footer"}
<body class="pear-container">
<div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
        <div class="layui-card">
            <form class="layui-form edit-form" method="post" action="">
                <div class="layui-tab layui-tab-brief" lay-filter="TabBrief">
                    <ul class="layui-tab-title">
                        <li class="layui-this">基础设置</li>
                        <li>上传设置</li>
                        <li>邮件设置</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-form-item">
                                <label class="layui-form-label">小程序ID</label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="applets_appId"
                                           value="{$data['applets_appId']??''}" type="text"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">小程序秘钥</label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="applets_secret"
                                           value="{$data['applets_secret']??''}" type="text"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">默认头像</label>
                                <div class="layui-input-block">
                                    {Upfile:uploadtag tagid='applets_default_avatar' name="applets_default_avatar"
                                    url="$data['applets_default_avatar']??[]" dir="config"/}
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    网站标题
                                </label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="title"
                                           value="{$data['title']??''}" type="text"/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    网站LOGO
                                </label>
                                <div class="layui-input-block">
                                    {Upfile:uploadtag tagid='logo' name="logo" url="$data['logo']??[]" dir="config"/}
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    登录验证码
                                </label>
                                <div class="layui-input-block">
                                    {if $data['login_captcha'] == 1}
                                    <input type="radio" name="login_captcha" value="1" title="开启" checked>
                                    <input type="radio" name="login_captcha" value="0" title="关闭">
                                    {else}
                                    <input type="radio" name="login_captcha" value="1" title="开启">
                                    <input type="radio" name="login_captcha" value="0" title="关闭" checked>
                                    {/if}
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-form-item">
                                <label class="layui-form-label">图片格式</label>
                                <div class="layui-input-block">
                                    <input type="text" autocomplete="off" class="layui-input" name="imgValidate_ext"
                                           value="{$data['imgValidate_ext']??''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">大小(kb)</label>
                                <div class="layui-input-block">
                                    <input type="text" autocomplete="off" class="layui-input" name="imgValidate_size"
                                           value="{$data['imgValidate_size']??''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">视频格式</label>
                                <div class="layui-input-block">
                                    <input type="text" autocomplete="off" class="layui-input" name="videoValidate_ext"
                                           value="{$data['videoValidate_ext']??''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">大小(kb)</label>
                                <div class="layui-input-block">
                                    <input type="text" autocomplete="off" class="layui-input" name="videoValidate_size"
                                           value="{$data['videoValidate_size']??''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">音频格式</label>
                                <div class="layui-input-block">
                                    <input type="text" autocomplete="off" class="layui-input" name="audioValidate_ext"
                                           value="{$data['audioValidate_ext']??''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">大小(kb)</label>
                                <div class="layui-input-block">
                                    <input type="text" autocomplete="off" class="layui-input" name="audioValidate_size"
                                           value="{$data['audioValidate_size']??''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">文件格式</label>
                                <div class="layui-input-block">
                                    <input type="text" autocomplete="off" class="layui-input" name="fileValidate_ext"
                                           value="{$data['fileValidate_ext']??''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">大小(kb)</label>
                                <div class="layui-input-block">
                                    <input type="text" autocomplete="off" class="layui-input" name="fileValidate_size"
                                           value="{$data['fileValidate_size']??''}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">存储方式</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="file_type" value="1" title="本地" {if
                                           condition="$data['file_type'] eq 1" } checked {/if} lay-filter="type">
                                    <input type="radio" name="file_type" value="2" title="阿里云" {if
                                           condition="$data['file_type'] eq 2" } checked {/if} lay-filter="type">
                                    <input type="radio" name="file_type" value="3" title="七牛云" {if
                                           condition="$data['file_type'] eq 3" } checked {/if} lay-filter="type">
                                </div>
                            </div>
                            <div class="layui-form-item" id="oss" {if condition="$data['file_type'] neq 2" }
                                 style="display: none;" {
                            /if}>
                            <div class="layui-form-item">
                                <label class="layui-form-label">Oss地址</label>
                                <div class="layui-input-block">
                                    <input type="text" name="file_endpoint" value="{$data['file_endpoint']??''}"
                                           placeholder="请输入Oss地址" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">空间名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="file_OssName" value="{$data['file_OssName']??''}"
                                           placeholder="请输入空间名称" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">KeyId</label>
                                <div class="layui-input-block">
                                    <input type="text" name="file_accessKeyId" value="{$data['file_accessKeyId']??''}"
                                           placeholder="请输入KeyId" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">KeySecret</label>
                                <div class="layui-input-block">
                                    <input type="text" name="file_accessKeySecret"
                                           value="{$data['file_accessKeySecret']??''}" placeholder="请输入KeySecret"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">Picture Url</label>
                                <div class="layui-input-block">
                                    <input type="text" name="file_pic_url"
                                           value="{$data['file_pic_url']??''}" placeholder="请输入Picture Url"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item" id="qiniu" {if condition="$data['file_type'] neq 3" }
                             style="display: none;" {
                        /if}>
                        <div class="layui-form-item">
                            <label class="layui-form-label">空间域名</label>
                            <div class="layui-input-block">
                                <input type="text" name="qiniu-Domain" value="{$data['qiniu-Domain']??''}"
                                       placeholder="请输入绑定空间域名" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">BUCKET</label>
                            <div class="layui-input-block">
                                <input type="text" name="qiniu_Bucket" value="{$data['qiniu_Bucket']??''}"
                                       placeholder="请输入空间BUCKET" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">AK</label>
                            <div class="layui-input-block">
                                <input type="text" name="qiniu_AK" value="{$data['qiniu_AK']??''}"
                                       placeholder="请输入AK"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">SK</label>
                            <div class="layui-input-block">
                                <input type="text" name="qiniu_SK" value="{$data['qiniu_SK']??''}"
                                       placeholder="请输入SK"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">Picture Url</label>
                            <div class="layui-input-block">
                                <input type="text" name="qiniu_pic_url" value="{$data['qiniu_pic_url']??''}"
                                       placeholder="请输入Picture Url"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">SMTPHost</label>
                        <div class="layui-input-block">
                            <input type="text" name="smtp_host" value="{$data['smtp_host']??''}"
                                   placeholder="请输入SMTPHost" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">SMTPUser</label>
                        <div class="layui-input-block">
                            <input type="text" name="smtp_user" value="{$data['smtp_user']??''}"
                                   placeholder="请输入SMTPUser" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">UserTitle</label>
                        <div class="layui-input-block">
                            <input type="text" name="smtp_title" value="{$data['smtp_title']??''}"
                                   placeholder="请输入UserTitle" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">SMTPPass</label>
                        <div class="layui-input-block">
                            <input type="text" name="smtp_pass" value="{$data['smtp_pass']??''}"
                                   placeholder="请输入SMTPPass" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">SMTPSecure</label>
                        <div class="layui-input-block">
                            <input type="text" name="smtp_ssl" value="{$data['smtp_ssl']??''}"
                                   placeholder="请输入SMTPSecure" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">SMTPPort</label>
                        <div class="layui-input-block">
                            <input type="text" name="smtp_port" value="{$data['smtp_port']??''}"
                                   placeholder="请输入SMTPPort" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
        </div>
    </div>
    <div class="layui-input-block" style="min-height: 80px;">
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit=""
                lay-filter="save">
            <i class="layui-icon layui-icon-ok"></i>
            提交
        </button>
        <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
            <i class="layui-icon layui-icon-refresh"></i>
            重置
        </button>
    </div>
    </form>
</div>
</div>
</div>
<script>
    layui.use(['form', 'jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(save)', function (data) {
            $.ajax({
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function (res) {
                    //判断有没有权限
                    if (res && res.code == 999) {
                        layer.msg(res.msg, {
                            icon: 5,
                            time: 2000,
                        })
                        return false;
                    } else if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                            location.reload();
                        });
                    } else {
                        layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                }
            })
            return false;
        });


        form.on('radio(type)', function (data) {
            if (data.value == 1) {
                $("#oss").hide();
                $("#qiniu").hide();
            }
            if (data.value == 2) {
                $("#oss").show();
                $("#qiniu").hide();
            }
            if (data.value == 3) {
                $("#qiniu").show();
                $("#oss").hide();
            }
        });
    })
</script>
</body>
</html>
